<template>
	<view class="container">
		<view class="van-nav-bar">
			<view class="van-nav-bar__content">
				<view class="van-nav-bar__left" @click="back()">
					<image src="/static/images/wyleft.png" mode="" style="width: 20px;height: 20px;"></image>
					<text style="color: #1989fa;">返回</text>
				</view>
			</view>
		</view>
		<view class="view-router">
			<view class="van-address-list">
				<view class="van-radio-group">
					<view class="van-address-item" v-for="(item,index) in list" :key="index">
						<view class="van-cell">
							<view class="van-cell__value">
								<view class="van-radio">
									<view style="width: 18px;height: 18px;border-radius: 50%;border: 1px #ccc solid;">
										
									</view>
									<text class="van-radio__label">
										<view class="van-address-item__name">
											{{item.name}} {{item.tel}}
										</view>
										<view class="van-address-item__address">
											{{item.province}}{{item.city}}{{item.county}} {{item.addressDetail}}
										</view>
									</text>
								</view>
							</view>
						</view>
					</view>
				</view>
				<view class="van-address-list__bottom">
					<button class="van-button" @click="edit()">
						<view class="van-button__content">
							<text>新增地址</text>
						</view>
					</button>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import api from '../../static/request'
	export default {
		data() {
			return {
				list:''
			}
		},
		onLoad() {
			this.getList()
		},
		methods: {
			getList() {
				uni.showLoading({
					title: '加载中'
				});
				api.get('address/list', {
			
				}).then(res => {
					console.log(res.data.data.list, '1')
					// 请求成功后隐藏加载提示
					uni.hideLoading(); 
					this.list=res.data.data.list
				})
			},
			back(){
				uni.switchTab({
					url: '/pages/mine/mine'
				});
			},
			edit(){
				uni.navigateTo({
					url:'/pages/edit/edit'
				})
			}
		}
	}
</script>

<style>
@import url('address.css');
</style>
